package com.dayu.rabbitmq.topic;

import java.io.IOException;
import java.util.concurrent.TimeoutException;

import com.dayu.rabbitmq.util.MQUtil;
import com.rabbitmq.client.Channel;
import com.rabbitmq.client.Connection;

/**
 * @author dayu
 * @date 2019/02/20
 * @Describe 将路由和某模式进行匹配
 * # 匹配一个或多个 * 匹配一个 
 */
public class Send {
    private static String EXCHANGE_NAME = "test_exchange_topic";

    public static void main(String[] args) throws IOException, TimeoutException {
        Connection connection = MQUtil.getConnection();

        Channel channel = connection.createChannel();

        channel.exchangeDeclare(EXCHANGE_NAME, "topic");

        String msg = "商品。。。。";

        channel.basicPublish(EXCHANGE_NAME, "goods.add", null, msg.getBytes());
        System.out.println("send " + msg);

        channel.close();
        connection.close();

    }
}
